package binance.controller
import binance.model.*

class UserController {
    def authenticate = {
        def user = User.findByEmailAndPassword(params.email, params.password)
        if (user) {
            session.user = user
            render(view:"/page/start")
        }else{
            render(template:"/user/login", var:"message", bean: "Faild to authenticate with email ${params.email}." )
        }
    }

    def logout = {
        session.user = null
        render(template:"/user/login", var:"message", bean: "" )
    }
}
